package com.ruoyi.rural.service.impl;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.rural.domain.RuralPovertyAlleviationMaterials;
import com.ruoyi.rural.mapper.RuralPovertyAlleviationMaterialsMapper;
import com.ruoyi.rural.service.IRuralPovertyAlleviationMaterialsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * 扶贫物资管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-02-26
 */
@Service
public class RuralPovertyAlleviationMaterialsServiceImpl implements IRuralPovertyAlleviationMaterialsService 
{
    @Autowired
    private RuralPovertyAlleviationMaterialsMapper ruralPovertyAlleviationMaterialsMapper;

    /**
     * 查询扶贫物资管理
     * 
     * @param id 扶贫物资管理主键
     * @return 扶贫物资管理
     */
    @Override
    public RuralPovertyAlleviationMaterials selectRuralPovertyAlleviationMaterialsById(String id)
    {
        return ruralPovertyAlleviationMaterialsMapper.selectRuralPovertyAlleviationMaterialsById(id);
    }

    /**
     * 查询扶贫物资管理列表
     * 
     * @param ruralPovertyAlleviationMaterials 扶贫物资管理
     * @return 扶贫物资管理
     */
    @Override
    public List<RuralPovertyAlleviationMaterials> selectRuralPovertyAlleviationMaterialsList(RuralPovertyAlleviationMaterials ruralPovertyAlleviationMaterials)
    {
        return ruralPovertyAlleviationMaterialsMapper.selectRuralPovertyAlleviationMaterialsList(ruralPovertyAlleviationMaterials);
    }

    /**
     * 新增扶贫物资管理
     * 
     * @param ruralPovertyAlleviationMaterials 扶贫物资管理
     * @return 结果
     */
    @Override
    public int insertRuralPovertyAlleviationMaterials(RuralPovertyAlleviationMaterials ruralPovertyAlleviationMaterials)
    {
        ruralPovertyAlleviationMaterials.setId(UUID.randomUUID().toString());
        ruralPovertyAlleviationMaterials.setCreateTime(DateUtils.getNowDate());
        return ruralPovertyAlleviationMaterialsMapper.insertRuralPovertyAlleviationMaterials(ruralPovertyAlleviationMaterials);
    }

    /**
     * 修改扶贫物资管理
     * 
     * @param ruralPovertyAlleviationMaterials 扶贫物资管理
     * @return 结果
     */
    @Override
    public int updateRuralPovertyAlleviationMaterials(RuralPovertyAlleviationMaterials ruralPovertyAlleviationMaterials)
    {
        ruralPovertyAlleviationMaterials.setUpdateTime(DateUtils.getNowDate());
        return ruralPovertyAlleviationMaterialsMapper.updateRuralPovertyAlleviationMaterials(ruralPovertyAlleviationMaterials);
    }

    /**
     * 批量删除扶贫物资管理
     * 
     * @param ids 需要删除的扶贫物资管理主键
     * @return 结果
     */
    @Override
    public int deleteRuralPovertyAlleviationMaterialsByIds(String[] ids)
    {
        return ruralPovertyAlleviationMaterialsMapper.deleteRuralPovertyAlleviationMaterialsByIds(ids);
    }

    /**
     * 删除扶贫物资管理信息
     * 
     * @param id 扶贫物资管理主键
     * @return 结果
     */
    @Override
    public int deleteRuralPovertyAlleviationMaterialsById(String id)
    {
        return ruralPovertyAlleviationMaterialsMapper.deleteRuralPovertyAlleviationMaterialsById(id);
    }
}
